const {
	admin,
	// upload,
	common,
	download,
	demo
} = require('controller'), { validateLogon } = require('interceptors/oauth');

module.exports = app => {
	/*
		移动端接口
	 */

	// 文件下载
	app.get(/^\/download*([^*]*)+$/, download);

	app.post('/demo/hospital/breath', demo.addBreathLog);
	app.get('/demo/hospital/breath/:deviceId', demo.getBreathLog);

	app.post('/demo/device', demo.addDevice);
	app.get('/demo/devices', demo.getDevices);
	app.delete('/demo/device/:id', demo.deleteDevice);

	/*
	    管理后台接口
	 */
	//后台登陆
	app.put('/user/signIn', admin.signIn);
	// app.put("/user/signOut", validateLogon, common.signOut);
	app.get('/admin/users', validateLogon, admin.getAdmins);
	app.post('/admin/user', validateLogon, admin.addAdmin);
	app.delete('/admin/user/:id', validateLogon, admin.deleteAdmin);
	app.put('/admin/user/:id/password', validateLogon, admin.updateAdminPassword);

	//上传服务 
	// app.post('/admin/upload', upload.upload);

}